package Main;

import GUI.*;

import java.io.File;
import javax.swing.*;
import javax.swing.filechooser.*;

public class ADV
{
	private ADVFrame frame;
	
	public ADV()
	{
		try
		{
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
		JFileChooser fc = new JFileChooser();
		FileFilter scriptFilter = new FileNameExtensionFilter("ADV Script Files(.script)","script");
		fc.addChoosableFileFilter(scriptFilter);
		
		int returnValue = fc.showOpenDialog(null);
		
		if (returnValue == JFileChooser.APPROVE_OPTION)
		{
			File file = fc.getSelectedFile();
			
			if (file != null && file.getName().endsWith(".script"))
			{
				frame = new ADVFrame(file);
			}
			else
			{
				JOptionPane.showMessageDialog(null,"Can't open the file!","Error",JOptionPane.ERROR_MESSAGE);
				System.exit(0);
			}
		}
	}
	
	public static void main(String args[])
	{
		ADV adv = new ADV();
	}
}